<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Forbid_resubmit {

	public $CI;

    public function __construct()
    {
        $this->CI =& get_instance();
        //载入类库
        $this->CI->load->library('session');
    }

    public function set_submit_rand()
    {
    	$rand = uniqid();
    	$this->CI->session->set_userdata('submit_rand', $rand);
    	return $rand;
    }

    public function rand_value()
    {
        return $this->set_submit_rand();
    }

    public function judge_submit($rand)
    {
    	if ($rand == $this->CI->session->userdata('submit_rand')) {
    		return true;
    	}
    	return false;
    }

}

?>